package My.example.service.impl;

import My.example.dao.mydao;
import My.example.service.myser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Service("ser1")
public class ser1 implements myser {
    @Autowired
    @Qualifier("dao1")
    private mydao dao;
    @Value("${name}")
    private String name;
    public void save() {
        System.out.println("ser1");
        dao.save();
        System.out.println(name);
    }
    public void out(int i){
        System.out.println("参数"+i);
    }
    @PreDestroy
    public void destroy(){
        System.out.println("结束");
    }
    @PostConstruct
    public void init(){
        System.out.println("开始");
    }
}
